package controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import po.Level;
import service.LevelService;
import utils.ResUtils;

import java.util.List;
@Controller
public class LevelController {
    @Autowired
    private LevelService levelService;

    // 获取类型列表数据
    @GetMapping("/levels")
    @ResponseBody
    public Object AllLevels() {

        List<Level> res = this.levelService.allLevel();

        if ( res != null) {
            return ResUtils.Success(1,"查询成功",res);
        } else {
            return ResUtils.Fail(0,"没有数据");
        }
    }
}
